package com.tencent.compose.sample

import kotlinx.serialization.Serializable

@Serializable
data class CloudImage(
    val fid: Long = 0,
    val category: Long = 0,
    val fileMD5: String = "",
    val fileSize: Long = 0,
    val collected: Boolean = false,
    val fromType: Long = 0,
    val isDelete: Boolean = false,
    val extentInt8: Long = 0,
    val takenTime: Double = 0.0,
    val serverCTime: Double = 0.0,
    val serverMTime: Double = 0.0,
    val localCTime: Double = 0.0,
    val localMTime: Double = 0.0,
    val year: Long = 0,
    val month: Long = 0,
    val day: Long = 0,
    var country: String = "",
    var province: String = "",
    var city: String = "",
    var district: String = "",
    var street: String = "",
    val formattedAddress: String = "",
    val businessDistrict: String = "",
    val duration: Double = 0.0,
    val supportSearch: Boolean = false,
    val showInAlbum: Boolean = false,
    val serverPath: String = "",
    val fileName: String = "",
    val orientation: Long = 0,
    val resolution: String = "",
    val longitude: Double = 0.0,
    val latitude: Double = 0.0,
    val tags: List<ImageTag> = emptyList(),
    val poiList: List<ImagePoi> = emptyList(),
) {
    companion object {
        fun setImageType(image: CloudImage) {
            // Implementation for setting image type based on file properties
        }
    }
}

@Serializable
data class BaseCloudImage(
    val fid: Long = 0,
    val fileMD5: String = "",
)

data class PersonInfo(
    val tagId: Long = 0,
    val uk: Long = 0,
    val remark: String = "",
    val phone: String = "",
    val relationship: String = "",
    val avatarFid: Long = 0,
    val avatarUrl: String = "",
    val faceCount: Long = 0,
)

@Serializable
data class ImageTag(
    val id: Long = 0,
    val type: Long = 0,
    val name: String = "",
    val isVisible: Boolean = false,
    val isModified: Boolean = false,
    var coverUrl: String = "",
    var coverFid: Long = 0,
    val objectSubType: Long = 0,
    val groupId: Long = 0,
    val groupName: String = "",
    val shouldFuzzy: Boolean = false,
    val iconUrl: String = "",
    val cloudImage: BaseCloudImage? = null,
    val tagIds: String = "",
)

data class RecommendTag(
    val tagId: Long = 0,
    val total: Long = 0,
    val type: String = "",
    val tagName: String = "",
    val coverUrl: String = "",
)

data class CityInfo(
    val name: String = "",
    val country: String = "",
    val type: CityType = CityType.CITY,
    val fid: Long? = null,
    val fileMd5: String? = null,
)

enum class CityType {
    CITY,
    COUNTRY,
}

data class DateInfo(
    val year: Long? = null,
    val month: Long,
    val day: Long,
)

@Serializable
data class ImagePoi(
    val poiName: String? = null,
    val poiTag: String? = null,
    val address: String? = null,
    val direction: String? = null,
    val distance: String? = null,
)

enum class ImageFromType {
    // Define image from types as needed
}

enum class Category4FindPicIndex {
    IMAGE,
    VIDEO,
    GIF,
    LIVP,
}

enum class ImageTagType {
    OBJECTS,
    PEOPLE,
}

enum class ImageObjectTagSubType {
    PERSONAL_DATA,
}

enum class CloudImageOrderBy {
    DATE_TAKEN,
}

data class CloudImageDBPredicate(
    val category: List<Category4FindPicIndex> = emptyList(),
    val fromType: List<ImageFromType> = emptyList(),
    val cityList: List<CityInfo> = emptyList(),
    val personList: List<PersonInfo> = emptyList(),
    val tagList: List<ImageTag> = emptyList(),
    val orderBy: CloudImageOrderBy = CloudImageOrderBy.DATE_TAKEN,
    val offset: Int = 0,
    val pageSize: Int = 200,
)

data class CloudImagesByTagPredicate(
    val cityList: List<CityInfo> = emptyList(),
    val tagIdList: List<Long> = emptyList(),
    val recommendTagList: List<RecommendTag>? = null,
    val offset: Int = 0,
    val pageSize: Int = 200,
)

data class Category4FindPicIndexPredicate(
    val city: CityInfo? = null,
    val category: Category4FindPicIndex? = null,
    val fileName: String? = null,
    val time: List<DateInfo> = emptyList(),
    val tagIds: List<Long> = emptyList(),
    val recommendTagList: List<RecommendTag>? = null,
    val haspPerson: Boolean = false,
    val offset: Int = 0,
    val pageSize: Int = 200,
)

data class TagDBPredicate(
    val tagType: ImageTagType,
    val subType: ImageObjectTagSubType? = null,
    val offset: Int = 0,
    val pageSize: Int = 200,
)

// data class PagingData<T>(
//    val list: List<T>,
//    val hasMore: Boolean,
//    val pageSize: Int,
//    val position: PagePosition
// )

data class PagePosition(
    val nextOffset: Int,
)

data class CategoryCountRsp(
    val videoCount: Long,
    val gifCount: Long,
    val livpCount: Long,
    val screenShotCount: Long,
    val selfCount: Long,
    val longPicCount: Long,
    val screenRecordingCount: Long,
)

data class CloudImageRsp(
    val recommendTag: List<RecommendTag>,
//    val imageList: PagingData<CloudImage>
)

enum class FileCategory {
    IMAGE,
    VIDEO,
}
